package com.tuozixuan.spring6.resources;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.Resource;

public class Demo1 {

	public static void main(String[] args) {
		ApplicationContext ctx = new ClassPathXmlApplicationContext();
		// 通过ApplicationContext访问资源
		// ApplicationContext实例获取Resource实例时，
		// 默认采用与ApplicationContext相同的资源访问策略
		Resource res = ctx.getResource("note-classpath.txt");
		System.out.println(res.getFilename());
	}
}
